<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>
<?php echo $this->namefield['name'].'-'.$this->title['name'];?>
</title>
<?php echo $this->headData; ?>
</head>
<body id="page_bg">
		<div id="wrapper2">
			<div id="wrapper">
				<div id="header">
					<div class="rk-1">
						<div class="rk-2">
							<a href="http://www.metinfo.cn" class="nounder" title="Metinfo Feedback - The power survey tool"></a>
						</div>
					</div>
				</div>
				<div class="surveyname"><?php echo $this->form['name'];?></div>

				<div class="survey-main">
					<table class="survey-survey-description" cellspacing="1">
						<tr>							
							<td>
								<?php echo $this->introducefield['name'];?>
							</td>
						</tr>
					</table>
					<table class="survey-survey-description" cellspacing="1">
						<tr class="row0">
							<td  class="key">
								<?php if(!strstr($this->form['startdate'],'0000-00-00')):
								?>
								<label>
									<?php echo C_text::_( 'Item2' ); ?>
								</label>
								<?php  echo substr($this->form['startdate'],0,10);
									endif;
									if(!strstr($this->form['finishdate'],'0000-00-00')):
								?>
								&nbsp;&nbsp;&nbsp;<?php echo C_text::_( 'Item3' ); ?>
								<?php  echo substr($this->form['finishdate'],0,10);
									endif;
								?>
								&nbsp;&nbsp;&nbsp;<?php echo C_text::_( 'Item4' ); ?>
								<?php echo count($this->questions); ?>
							</td>
						</tr>

					</table>
					<form enctype="multipart/form-data" method='post' action='<?php echo WEBSELF; ?>/site' id='siteform' name='siteform'>
						<input type='hidden' id='username' value='metinfo' />
						<input type='hidden' id='category' value='公司' />
						<div class="survey-survey">
							<!-- START THE GROUP -->
							<div class="survey-groupname"></div>	
							<div class="survey-groupdescription"></div>
							<div id="question-all" class="array-5-pt">		
								<?php
										$q = $this->questions;
										$a = $this->answers;
										$mulselect = '';
										$upload = '';
										$selectlist = '';
										$lang = 'name';
										$i=0;
										foreach($q AS $key=>$value)
										{
											$must = $q[$key]['wr_ok']==1?'must':'';
											$cmust = $q[$key]['wr_ok']==1?'class="must"':'';
											
								?>
								<div class="survey-question">
									<div class="survey-question-text">
									No.<?php echo ($i+1)." - {$q[$key][$lang]}".($q[$key]['wr_ok']==1?'  <span style="color:blue;font-size:13px;font-weight:bold"> *'.C_text::_('Required').'</span>':'');?><br /><br />
									</div>
									<div class="survey-question-answer">
										<?php
											switch($q[$key]['type'])
											{
												case 1:
														echo '<p class="question"><input '.$cmust.' type="text" maxlength="255" value="" id="feedback['.$q[$key]['id'].']" name="feedback['.$q[$key]['id'].']" size="50" /></p>';
														break;
												case 2:
														$tmp[] = C_html::_('select.option', '0', '- '.C_text::_('SelectType').' -', 'id', $lang);
														for($j=0;$j<count($a);$j++)
														{
															if($a[$j]->bigid==$q[$key]['id'])	$tmp[]=$a[$j];
														}														
														echo C_html::_('select.genericlist', $tmp, "feedback[{$q[$key]['id']}]", $cmust, $lang, $lang);
														unset($tmp);
														$selectlist .= $q[$key]['id'].'|';
														break;
												case 3:
														echo '<p class="question"><textarea  cols="40" rows="5" value="" id="feedback['.$q[$key]['id'].']" name="feedback['.$q[$key]['id'].']" class="textarea '.$must.'"></textarea></p>';
														break;
												case 5:
														echo '<p class="question"><input '.$cmust.' type="file" name="feedback['.$q[$key]['id'].']" id="feedback['.$q[$key]['id'].']" size="50"/></p>';
														$upload .= $q[$key]['id'].'|';
														break;
												case 4:
												case 6:														
														$tmp = array();
														$style = unserialize($q[$key]['params']);
														for($j=0;$j<count($a);$j++)
														{
															if($a[$j]->bigid==$q[$key]['id'])	$tmp[]=$a[$j];
														}
														if($q[$key]['type'] == 4) $mulselect .= $q[$key]['id'].'|';
														if(!$style || empty($style['fieldstyle'])) $style['fieldstyle'] = 'type_row';
														echo '<div class="list-radio">'.C_html::_('list.list_type', $tmp, "feedback[{$q[$key]['id']}]",$q[$key]['type'],$cmust,'',$lang,$lang,$style['fieldstyle']).'</div>';
														unset($tmp);
											}
										?>										
									</div>
								</div>
								<?php
								$i++;
										}
								?>								
								<div class="survey-question-space"></div>
							</div>
							<center>
								<div class="survey-navigator">
									<input type="hidden" name="task" value="" />
									<input type="hidden" name="lang" value="<?php echo $this->lang['lang_code']; ?>" />
									<input type="hidden" name="form" value="<?php echo $SYS->request->getVar( "form" );; ?>" />
									<input type="hidden" name="mulselect" value="<?php echo $mulselect;?>" />
									<input type="hidden" name="upload" value="<?php echo $upload;?>" />
									<input type="hidden" name="selectlist" value="<?php echo $selectlist;?>" />
									<input class='submit' type='button' onclick="javascript:validate()" value='<?php echo C_text::_('Item1');?>' />
								</div>
							</center>
						</div>
					</form>
				</div>				
				<div id="footer">
					<a href="http://www.metinfo.cn">Metinfo is Open-Source software</a>
				</div>
				<?php 
				if(count($this->onlinelist)>0) include ('online.html');
				?>
			</div>
		</div>

<?php  echo $this->js; ?>
</body>
</html>